/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import dto.Announcement;
import java.util.Date;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author A7med Kotb
 */
public class AnnouncementBean extends org.apache.struts.action.ActionForm 
{    
        private Integer annId;
	private Date annDuration;
	private String annBody;

    public String getAnnBody() {
        return annBody;
    }

    public void setAnnBody(String annBody) {
        this.annBody = annBody;
    }

    public Date getAnnDuration() {
        return annDuration;
    }

    public void setAnnDuration(Date annDuration) {
        this.annDuration = annDuration;
    }

    public Integer getAnnId() {
        return annId;
    }

    public void setAnnId(Integer annId) {
        this.annId = annId;
    }
    Vector<Announcement> vect = new Vector<Announcement>();

    public Vector<Announcement> getVect() {
        return vect;
    }

    public void setVect(Vector<Announcement> vect) {
        this.vect = vect;
    }

    
   
    public AnnouncementBean() 
    {
        super();
        // TODO Auto-generated constructor stub
    }

   
    

   

    
    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        try{
        if ((getAnnBody().trim()).length()<1 && mapping.getParameter().trim().equals("Add"))
        {
            errors.add("annbody", new ActionMessage("Pease Enter Announcement Body"));
        }
        }
        catch(Exception e)
        {}
        return errors;
    }
}
